<template>
    <component is="a-modal" v-model:visible="visible" width="80%" :title="title" :mask-closable="false"
        :ok-loading="loading" @cancel="close" @before-ok="submit">
        <div style="height: 70vh;overflow-y: scroll;">
            <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
                <template #tableSearch>
                    <a-col :span="6">
                        <a-form-item field="user" label="会员信息">
                            <a-input allow-clear v-model="searchForm.user" placeholder="会员UID|会员账号"
                                @keydown.enter="refresh" />
                        </a-form-item>
                    </a-col>
                </template>
                <template #total="{ record }">
                    <div v-for="(itm, idx) in record.withdraw" :key="idx">
                        <di style="font-weight: 600;color: #4c6ef5;font-size: 16px;">{{ itm.area_text }}总提现</di>
                        <div v-if="itm.area == 2">
                            <div>历史总提现: {{ itm.total_num }} ( ¥ {{ itm.total_num_cn }} )
                                本年度总提现：{{ itm.year_total_num }} ( ¥ {{ itm.total_num_year_cn }} )
                            </div>
                            <div>实際总提现: {{ itm.get_total_num }} {{ itm.get_points }}
                                本年度实際总提现：{{ itm.get_total_num_year }} {{ itm.get_points }}
                            </div>
                        </div>
                        <div v-else>
                            <div>历史总提现: {{ itm.total_num }}
                                本年度总提现：{{ itm.year_total_num }}
                            </div>
                            <div>歷史实際总提现: {{ itm.get_total_num }} {{ itm.get_points }}
                                本年度实際总提现：{{ itm.get_total_num_year }}{{ itm.get_points }}
                            </div>
                        </div>
                    </div>
                </template>
            </sa-table>
        </div>
    </component>
</template>
<script setup>
import { onMounted, ref, reactive, computed, watch } from 'vue'
import memberApi from '@/api/system/member'
import SaTable from '@cps/sa-table/index.vue'
import { Message } from '@arco-design/web-vue'
import { throttle } from 'lodash';
import tool from '@/utils/tool'
const emit = defineEmits(["success"]);
const visible = ref(false);
const title = ref('')
const crudRef = ref()
const loading = ref(false);
const searchForm = ref({
    user: '',
})
const options = reactive({
    api: memberApi.widthdraw_total,//表格数据接口
    operationColumnWidth: 200,//操作欄
    columnAlign: 'left',
    pageSimple: false,
    isExpand: false,//展開所有子樹
    operationColumn: false,
})
const columns = reactive([
    { title: 'UID', dataIndex: 'user_id', width: 100 },
    { title: '会员账号', dataIndex: 'user_name', width: 180 },
    { title: '姓名', dataIndex: 'true_name', width: 180 },
    { title: '提现统计', dataIndex: 'total', width: 300 },
])
const open = async (data) => {
    console.log('111', data);
    title.value = '提现统计'
    visible.value = true;
    getParams()
    refresh()
}
const refresh = async () => {
    crudRef.value?.refresh()
}
const paramsData = ref({})
const getParams = async () => {

}
defineExpose({ open });
</script>
<style lang="less" scoped>
.pagination {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}
</style>